//
//  ICSocketCommunicationManager.h
//  ICome
//
//  Created by zhangrongwu on 16/8/4.
//  Copyright © 2016年 iCom. All rights reserved.
//  数据处理

#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, SocketType) {
    SCRequestType_Beat = 1,                       //心跳
    SCRequestType_Normal
};
typedef void (^SocketDidReadBlock)(id data, NSError *error, id other);

@interface ICSocketCommunicationManager : NSObject

@property (nonatomic, strong)NSMutableDictionary *requestsMap;

@property (nonatomic, strong)NSMutableArray *requestsList;

+(ICSocketCommunicationManager *)sharedInstance;


/**
 *  tcp request
 *
 *  @param type       request type
 *  @param body       request param
 *  @param identifier request identifier (can 0)
 *  @param callback   block
 */
-(void)requestWithRequestType:(SocketType)type
                  requestBody:(NSDictionary *)body
                   Identifier:(NSString *)identifier
                   completion:(SocketDidReadBlock)callback;
// 接收tcp层数据回调
- (void)receiveServerData:(NSData*)data callbackIdentifier:(NSInteger)identifier;

// 重新发送数据
- (void)reSendRequest;

@end




